const Email = require('../email/Email')
const path = require('path')

//@Bean
class EmailService {

	//@Value(account.email.user)
	user;

	//@Value(account.email.pass)
	pass;

	beanInit(){
		this.email = new Email(this.user,this.pass)
	}

	async orderSuccess(order,system){
		const {name,price,platform} = order;
		return this.email.sendHtml(this.user,`[${platform} - ${order.type}] ${name}-${price}`,path.join(__dirname,'../assert','orderSuccess.html'),{order,system})
	}

	async error(msg){
		return this.email.sendMsg(this.user,"系统错误",msg)
	}

}


module.exports = {EmailService}